<?
header('Access-Control-Allow-Origin:*'); 
header('Access-Control-Allow-Methods:POST,GET,PUT,OPTIONS,DELETE');
//写入文件
file_put_contents($_POST["username"].".txt",json_encode($_POST["pwd"]));
// file_put_contents("5555.txt",json_encode([["usernmae"=>"张三"]]));

$str = file_get_contents("5555.txt");
var_dump(json_decode($str)[0]->usernmae);

// //从文件内获取之前注册的数据
// $pwd = file_get_contents($_POST["username"].".txt");
// if(trim($pwd,'"') == $_POST["pwd"]){
//     echo json_encode(["code"=>200,'msg'=>'success']);
// }else{
//     echo json_encode(["code"=>-1,'msg'=>'pwd error']);
// }

?>